<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录页面</title>
    <style>
        body{
            font-family: 'Montserrat', sans-serif;
            font-size: 100%;
            background: url(${ctx}/ui/images/bbb.jpg)no-repeat;
            background-size: cover;
        }
        .login-ic i {
            background: url(${ctx}/ui/images/m.png)no-repeat 6px 6px;
            width: 38px;
            height: 38px;
            float: left;
            /*-- agileits --*/
            display: inline-block;
        }
        .login-ic i.icon {
            background: url(${ctx}/ui/images/l.png)no-repeat 6px 6px;
        }
    </style>
    <link rel="stylesheet" href="${ctx}/ui/css/logincss/style.css" type="text/css">
    <link   rel="stylesheet" href="${ctx}/ui/pre/css/style.css"  type="text/css">
    <script src="${ctx}/ui/jslib/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="${ctx}/ui/jslib/extJquery.js?v=201305301341" charset="utf-8"></script>
    <script src="https://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.min.js"></script>
    <script type="text/javascript">
        document.onkeydown=function() {
            if(event.keyCode==13) {
                formSubmit();
            }
        }

        function formSubmit(){
            var ajaxCallUrl = '${ctx}/user/logins';
            var name = $("#name").val();
            var pass = $("#pass").val();
            if(name!=''){
                $.ajax({
                    type: "POST",
                    url:ajaxCallUrl,
                    data:{
                        username:name,
                        password:md5(pass)
                    },
                    async: false,
                    //contentType:'application/json;charset=UTF-8',
                    error: function(request) {
                        alert("用户名或密码错误!");
                    },
                    success: function(data) {
                        if(data.success){
                            self.location = '${ctx}/user/toIndex.shtml';
                        }else{
                            alert(data.msg);
                            $("#name").val('');
                            $("#pass").val('');
                        }
                    }
                });
            }else{
                $("#name").val('');
                $("#pass").val('');
            }
        }

        function clearInfo(){
            $("#name").val('');
            $("#pass").val('');
        }
    </script>
</head>

<body>
<script>
    var h=$(document).height();
    $("body").css("height",h);
</script>
<div>
    <form id="logins">
        <%--<div class="login">--%>
            <%--<div class="head">--%>
                <%--<img src="${ctx}/ui/pre/images/logo.png" class="logo floatL">--%>
                <%--<h1 class="floatL">内蒙古福瑞沃科CMS</h1>--%>
            <%--</div>--%>
            <%--<div class="main">--%>
                <%--<span>账　号：</span><input type="text" name="username" id="name" autocomplete="off"><br>--%>
                <%--<span>密　码：</span><input type="password" name="password" id="pass" autocomplete="off"><br>--%>
                <%--&lt;%&ndash;<span>验证码：</span><input class="input"><img src="images/yzm.jpg" class="yzm"><br>&ndash;%&gt;--%>
                <%--<a onclick="formSubmit()" style="cursor:pointer;">登 录</a>--%>
            <%--</div>--%>
        <%--</div>--%>

        <div class="login-form">
            <div class="top-login">
                <span><img src="${ctx}/ui/images/group.png" alt=""/></span>
            </div>
            <h1>登录</h1>
            <div class="login-top">
                    <div class="login-ic">
                        <i ></i>
                        <input type="text"    name="username" id="name">
                        <div class="clear"> </div>
                    </div>
                    <div class="login-ic">
                        <i class="icon"></i>
                        <input type="password"  name="password" id="pass"/>
                        <div class="clear"> </div>
                    </div>
                    <div class="log-bwn">
                        <input type="button"  value="登 录" onclick="formSubmit()" style="cursor:pointer;">
                    </div>
            </div>
        </div>
    </form>
</div>
</body>
</html>